<template>
	<view>
		<view class="stock_top">
			<view class="stock_item">
				<view class="stock_item_title">尺码</view>
				<view class="stock_item_content">
					<u-radio-group v-model="value" @change="radioGroupChange">
						<u-radio 
							@change="radioChange" 
							v-for="(item, index) in stocklist" :key="index" 
							:name="item.name"
							:disabled="item.disabled"
						>
							{{item.name}}
						</u-radio>
					</u-radio-group>
				</view>
			</view>
			<view class="stock_item">
				<view class="stock_item_title">颜色</view>
				<view class="stock_item_content">
					<u-radio-group v-model="value1" @change="radioGroupChange1">
						<u-radio 
							@change="radioChange1" 
							v-for="(item, index) in stocklist1" :key="index" 
							:name="item.name"
							:disabled="item.disabled"
						>
							{{item.name}}
						</u-radio>
					</u-radio-group>
				</view>
			</view>
			<view class="stockbtn">点击查询</view>
		</view>
		<view class="stock_search">
			<view class="stock_searchitem">
				<text>租赁</text>
				<text>5件</text>
			</view>
			<view class="stock_searchitem">
				<text>售出</text>
				<text>5件</text>
			</view>
			<view class="stock_searchitem">
				<text>送洗</text>
				<text>5件</text>
			</view>
			<view class="stock_searchitem">
				<text>展厅</text>
				<text>5件</text>
			</view>
			<view class="stock_searchitem">
				<text>剩余</text>
				<text>5件</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				stocklist: [
					{
						name: '34',
						disabled: false
					},
					{
						name: '35',
						disabled: false
					},
					{
						name: '36',
						disabled: false
					},
					{
						name: '37',
						disabled: false
					},
					{
						name: '38',
						disabled: false
					},
					{
						name: '39',
						disabled: false
					}
				],
				// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
				value: '',
				stocklist1: [
					{
						name: '红色',
						disabled: false
					},
					{
						name: '白色',
						disabled: false
					},
					{
						name: '蓝色',
						disabled: false
					},
					{
						name: '紫色',
						disabled: false
					},
					{
						name: '黑色',
						disabled: false
					},
					{
						name: '黄色',
						disabled: false
					}
				],
				// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
				value1: '',
			}
		},
		methods: {
			// 选中某个单选框时，由radio时触发
			radioChange(e) {
				console.log(e);
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChange(e) {
				console.log(e);
			},
			// 选中某个单选框时，由radio时触发
			radioChange1(e) {
				console.log(e);
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChange1(e) {
				console.log(e);
			}
		}
	}
</script>

<style>
page{
	background: #f6f6f6;
}
.u-radio{
	margin-bottom: 12rpx;
}
.stock_top{
	background: #fff;
	width: 90%;
	padding: 5%;
}
.stock_item{
	margin-bottom: 8%;
}
.stock_item_title{
	font-size: 36rpx;
	font-weight: 700;
}
.stock_item_content{
	margin-top: 4%;
	overflow: hidden;
}
.stockbtn{
	width: 50%;
	margin: 0 25%;
	margin-top: 6%;
	text-align: center;
	background: #ff3f3f;
	color: #fff;
	font-size: 36rpx;
	line-height: 2;
	border-radius: 10rpx;;
}
.stock_search{
	width: 84%;
	margin: 0 3%;
	margin-top: 6%;
	background: #fff;
	border-radius: 10rpx;
	padding: 2% 5%;
	box-shadow: 4rpx 4rpx 20rpx #ccc;
}
.stock_searchitem{
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 8% 0;
}
.stock_searchitem text:nth-child(1){
	color: #525252;
}
.stock_searchitem text:nth-child(2){
	color: #353535;
}
</style>
